package com.geekcoding.geekoj.repository;

import com.geekcoding.geekoj.entity.Question;
import com.geekcoding.geekoj.entity.Test;
import com.geekcoding.geekoj.entity.UserEntity;
import com.geekcoding.geekoj.mapper.QuestionMapper;
import org.springframework.stereotype.Repository;

@Repository
public class QuestionRepository extends BaseRepository<Question, Question, QuestionMapper>{
    @Override
    public Question convert(Question entity) {
        return entity;
    }

    public Question nextSequence(Test test, UserEntity userEntity){
        return baseMapper.nextSequenceQuestion(test.getSubjectId(), test.getId(), userEntity.getId());
    }

    public Question nextRandom(Test test, UserEntity userEntity){
        return baseMapper.nextRandomQuestion(test.getSubjectId(), test.getId(), userEntity.getId());
    }
}
